package com.youlai.system.converter;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.youlai.system.common.model.Option;
import com.youlai.system.model.entity.SysMeasure;
import com.youlai.system.model.form.MeasureForm;
import com.youlai.system.model.vo.MeasurePageVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

/**
 * 整改措施对象转换器
 */
@Mapper(componentModel = "spring")
public interface MeasureConverter {
    Page<MeasurePageVO> entity2Page(Page<SysMeasure> page);

    SysMeasure form2Entity(MeasureForm measureForm);

    MeasureForm entity2Form(SysMeasure entity);

    @Mappings({
            @Mapping(target = "value", source = "id"),
            @Mapping(target = "label", source = "content")
    })
    Option entity2Option(SysMeasure measure);


    List<Option> entities2Options(List<SysMeasure> measures);
}
